<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加话题</title>
<script type="text/javascript" src="../../js/tools/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../../js/editor/kindeditor.js"></script>
<style>
table{table-layout:fixed;font-size:12px;}
  tr{background-color:#F1F6F6;}
  td{border:1px solid #D9D9D9;color:black;padding:2px;}
</style>
<script type="text/javascript">
   KE.show({
				id : 'content',
				resizeMode : 1,
				allowPreviewEmoticons : false,
				allowUpload : false,
				width:'100%',
				height:'200',
				items : []
			});
			function check()
			{
			  var login="<s:property value="#session.user.email"/>";
			  if(login!="")
			  {
			     var title=$.trim($("input[name='title']").val());
			     var content=$.trim($("#content").val());
			     var publisher='<%=request.getParameter("userId") %>';
			     if(title.length==0||title.length>30)
			     {
			        alert("标题的字数在1~30");
			        return false;
			     }
			     if(content.length==0||content.length>200)
			     {
			        alert("内容的字数在1~200");
			        return false;
			     }
			     $.getJSON("../../groupbyajax/brand!addTopic.action",{publisher:publisher,title:title,content:content},function(data){
					 window.open('','_parent','');
                     window.close(); 
                    alert("添加成功！");
				}) ;
			    
			   }else
			   {
			      alert("请登录！");
			     
			   }
			}
			 
</script>
</head>
<body>

 <table  style="width:80%;" align="center">
  <tr><td  align="center"><s:actionerror/></td></tr>
 <tr><td align="center"><font size=5>添加话题</font></td></tr>
 <tr><td>标题:</td></tr>
 <tr><td><input type="text" name="title"></td></tr>
 <tr><td>内容：</td></tr>
  <tr><td><textarea  name="content" id="content"></textarea></td></tr>
<tr>
    <td  align="center">
       <input type="button" onclick="check()" value="添加">
    </td>
</tr>
</table>

</body>
</html>